package com.xxx.nio;

import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.FileVisitor;
import java.nio.file.attribute.BasicFileAttributes;

/**
 * @version v1.0
 * @Description
 * @Author admin
 * @date 2021/7/23  16:11
 * @Copyright
 */
public class DOME01 implements FileVisitor {

    @Override
    public FileVisitResult preVisitDirectory(Object dir, BasicFileAttributes attrs) throws IOException {
        System.out.println("dir = " + dir);
        return FileVisitResult.CONTINUE ;
        //之前
    }

    @Override
    public FileVisitResult visitFile(Object file, BasicFileAttributes attrs) throws IOException {
        System.out.println("file = " + file);
        return  FileVisitResult.CONTINUE ;
        //文件
    }

    @Override
    public FileVisitResult visitFileFailed(Object file, IOException exc) throws IOException {
        System.out.println("file = " + file);
        return  FileVisitResult.CONTINUE ;
        //失败
    }

    @Override
    public FileVisitResult postVisitDirectory(Object dir, IOException exc) throws IOException {
        System.out.println("dir = " + dir);
        return  FileVisitResult.CONTINUE ;
        //之后

    }
}
